package com.aaa.controller;

import com.aaa.pojo.Student;
import com.aaa.service.StudentService;
import com.aaa.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class StudentController {
    @Autowired
    private StudentService studentService;
    @GetMapping("getById/{id}")
    public Result getById(@PathVariable Integer id){
        return studentService.queryById(id);

    }
    @GetMapping("getAll")
    public Result getAll(){
       return studentService.queryAll();
    }

    @PostMapping("save")
    public Result getSave(@RequestBody Student student){
        return studentService.querysave(student);
    }
    @DeleteMapping("delete/{sid}")
    public Result getDelete(@PathVariable Integer sid){
        return studentService.querydelete(sid);
    }
    @PutMapping("update")
    public Result getUpdate(@RequestBody Student student){
        return studentService.queryupdate(student);
    }

}
